package dotsandboxs;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Status.java 实现Serializable接口，用于存储每一次下完棋后的状态
 */
public class Status implements Serializable {
    ArrayList<Status> list = new ArrayList<>();
    int[] block = new int[25];
    int[] redBox = new int[25];
    int[] blueBox = new int[25];
    int[] side = new int[60];
    int[] redSide = new int[60];
    int[] blueSide = new int[60];
    int color;// 0表示红色，1表示蓝色
    int count;// 点击坐标点数目的标志;
    int redBlock;
    int blueBlock;
    int sideCount;// 边下标计数器
    int redSideCount;// 红边下标计数器
    int blueSideCount;// 蓝边下标计数器
    int boxCount;// 格子下标计数器
    int redBoxCount;// 红格子下标计数器
    int blueBoxCount;// 蓝格子下标计数器
    int gameMode;//是否已经开始游戏的标志

    /**
     * 状态类带参数的构造方法
     *
     * @param gui 界面类对象
     */
    public Status(ChessGUI gui) {
        System.arraycopy(gui.block, 0, this.block, 0, this.block.length);
        System.arraycopy(gui.redBox, 0, this.redBox, 0, this.redBox.length);
        System.arraycopy(gui.blueBox, 0, this.blueBox, 0, this.blueBox.length);
        System.arraycopy(gui.side, 0, this.side, 0, this.side.length);
        System.arraycopy(gui.redSide, 0, this.redSide, 0, this.redSide.length);
        System.arraycopy(gui.blueSide, 0, this.blueSide, 0, this.blueSide.length);
        for (int i = list.size() - 1; i > 0; i--) {
            list.add(gui.list.get(i));
        }
        this.color = gui.color;
        this.redBlock = gui.redBlock;
        this.blueBlock = gui.blueBlock;
        this.sideCount = gui.sideCount;
        this.redSideCount = gui.redSideCount;
        this.blueSideCount = gui.blueSideCount;
        this.boxCount = gui.boxCount;
        this.redBoxCount = gui.redBoxCount;
        this.blueBoxCount = gui.blueBoxCount;
        this.gameMode = gui.gameMode;
    }
}
